1 /*
2  * This file is part of gtkD.
3  *
4  * gtkD is free software; you can redistribute it and/or modify
5  * it under the terms of the GNU Lesser General Public License
6  * as published by the Free Software Foundation; either version 3
7  * of the License, or (at your option) any later version, with
8  * some exceptions, please read the COPYING file.
9  *
10  * gtkD is distributed in the hope that it will be useful,
11  * but WITHOUT ANY WARRANTY; without even the implied warranty of
12  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
13  * GNU Lesser General Public License for more details.
14  *
15  * You should have received a copy of the GNU Lesser General Public License
16  * along with gtkD; if not, write to the Free Software
17  * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110, USA
18  */
19 
20 // generated automatically - do not change
21 // find conversion definition on APILookup.txt
22 // implement new conversion functionalities on the wrap.utils pakage
23 
24 
25 module gtk.Text;
26 
27 private import gio.MenuModel;
28 private import glib.ConstructionException;
29 private import glib.MemorySlice;
30 private import glib.Str;
31 private import glib.c.functions;
32 private import gobject.ObjectG;
33 private import gobject.Signals;
34 private import graphene.Rect;
35 private import gtk.EditableIF;
36 private import gtk.EditableT;
37 private import gtk.EntryBuffer;
38 private import gtk.Widget;
39 private import gtk.c.functions;
40 public  import gtk.c.types;
41 private import pango.PgAttributeList;
42 private import pango.PgTabArray;
43 private import std.algorithm;
44 
45 
46 /**
47  * The `GtkText` widget is a single-line text entry widget.
48  * 
49  * `GtkText` is the common implementation of single-line text editing
50  * that is shared between `GtkEntry`, `GtkPasswordEntry`, `GtkSpinButton`
51  * and other widgets. In all of these, `GtkText` is used as the delegate
52  * for the [iface@Gtk.Editable] implementation.
53  * 
54  * A fairly large set of key bindings are supported by default. If the
55  * entered text is longer than the allocation of the widget, the widget
56  * will scroll so that the cursor position is visible.
57  * 
58  * When using an entry for passwords and other sensitive information,
59  * it can be put into “password mode” using [method@Gtk.Text.set_visibility].
60  * In this mode, entered text is displayed using a “invisible” character.
61  * By default, GTK picks the best invisible character that is available
62  * in the current font, but it can be changed with
63  * [method@Gtk.Text.set_invisible_char].
64  * 
65  * If you are looking to add icons or progress display in an entry, look
66  * at `GtkEntry`. There other alternatives for more specialized use cases,
67  * such as `GtkSearchEntry`.
68  * 
69  * If you need multi-line editable text, look at `GtkTextView`.
70  * 
71  * # CSS nodes
72  * 
73  * ```
74  * text[.read-only]
75  * ├── placeholder
76  * ├── undershoot.left
77  * ├── undershoot.right
78  * ├── [selection]
79  * ├── [block-cursor]
80  * ╰── [window.popup]
81  * ```
82  * 
83  * `GtkText` has a main node with the name text. Depending on the properties
84  * of the widget, the .read-only style class may appear.
85  * 
86  * When the entry has a selection, it adds a subnode with the name selection.
87  * 
88  * When the entry is in overwrite mode, it adds a subnode with the name
89  * block-cursor that determines how the block cursor is drawn.
90  * 
91  * The CSS node for a context menu is added as a subnode below text as well.
92  * 
93  * The undershoot nodes are used to draw the underflow indication when content
94  * is scrolled out of view. These nodes get the .left and .right style classes
95  * added depending on where the indication is drawn.
96  * 
97  * When touch is used and touch selection handles are shown, they are using
98  * CSS nodes with name cursor-handle. They get the .top or .bottom style class
99  * depending on where they are shown in relation to the selection. If there is
100  * just a single handle for the text cursor, it gets the style class
101  * .insertion-cursor.
102  * 
103  * # Accessibility
104  * 
105  * `GtkText` uses the %GTK_ACCESSIBLE_ROLE_NONE role, which causes it to be
106  * skipped for accessibility. This is because `GtkText` is expected to be used
107  * as a delegate for a `GtkEditable` implementation that will be represented
108  * to accessibility.
109  */
110 public class Text : Widget, EditableIF
111 {
112 	/** the main Gtk struct */
113 	protected GtkText* gtkText;
114 
115 	/** Get the main Gtk struct */
116 	public GtkText* getTextStruct(bool transferOwnership = false)
117 	{
118 		if (transferOwnership)
119 			ownedRef = false;
120 		return gtkText;
121 	}
122 
123 	/** the main Gtk struct as a void* */
124 	protected override void* getStruct()
125 	{
126 		return cast(void*)gtkText;
127 	}
128 
129 	/**
130 	 * Sets our main struct and passes it to the parent class.
131 	 */
132 	public this (GtkText* gtkText, bool ownedRef = false)
133 	{
134 		this.gtkText = gtkText;
135 		super(cast(GtkWidget*)gtkText, ownedRef);
136 	}
137 
138 	// add the Editable capabilities
139 	mixin EditableT!(GtkText);
140 
141 
142 	/** */
143 	public static GType getType()
144 	{
145 		return gtk_text_get_type();
146 	}
147 
148 	/**
149 	 * Creates a new `GtkText`.
150 	 *
151 	 * Returns: a new `GtkText`.
152 	 *
153 	 * Throws: ConstructionException GTK+ fails to create the object.
154 	 */
155 	public this()
156 	{
157 		auto __p = gtk_text_new();
158 
159 		if(__p is null)
160 		{
161 			throw new ConstructionException("null returned by new");
162 		}
163 
164 		this(cast(GtkText*) __p);
165 	}
166 
167 	/**
168 	 * Creates a new `GtkText` with the specified text buffer.
169 	 *
170 	 * Params:
171 	 *     buffer = The buffer to use for the new `GtkText`.
172 	 *
173 	 * Returns: a new `GtkText`
174 	 *
175 	 * Throws: ConstructionException GTK+ fails to create the object.
176 	 */
177 	public this(EntryBuffer buffer)
178 	{
179 		auto __p = gtk_text_new_with_buffer((buffer is null) ? null : buffer.getEntryBufferStruct());
180 
181 		if(__p is null)
182 		{
183 			throw new ConstructionException("null returned by new_with_buffer");
184 		}
185 
186 		this(cast(GtkText*) __p);
187 	}
188 
189 	/**
190 	 * Determine the positions of the strong and weak cursors if the
191 	 * insertion point in the layout is at @position.
192 	 *
193 	 * The position of each cursor is stored as a zero-width rectangle.
194 	 * The strong cursor location is the location where characters of
195 	 * the directionality equal to the base direction are inserted.
196 	 * The weak cursor location is the location where characters of
197 	 * the directionality opposite to the base direction are inserted.
198 	 *
199 	 * The rectangle positions are in widget coordinates.
200 	 *
201 	 * Params:
202 	 *     position = the character position
203 	 *     strong = location to store the strong cursor position
204 	 *     weak = location to store the weak cursor position
205 	 *
206 	 * Since: 4.4
207 	 */
208 	public void computeCursorExtents(size_t position, out Rect strong, out Rect weak)
209 	{
210 		graphene_rect_t* outstrong = sliceNew!graphene_rect_t();
211 		graphene_rect_t* outweak = sliceNew!graphene_rect_t();
212 
213 		gtk_text_compute_cursor_extents(gtkText, position, outstrong, outweak);
214 
215 		strong = ObjectG.getDObject!(Rect)(outstrong, true);
216 		weak = ObjectG.getDObject!(Rect)(outweak, true);
217 	}
218 
219 	/**
220 	 * Returns whether pressing Enter will activate
221 	 * the default widget for the window containing @self.
222 	 *
223 	 * See [method@Gtk.Text.set_activates_default].
224 	 *
225 	 * Returns: %TRUE if the `GtkText` will activate the default widget
226 	 */
227 	public bool getActivatesDefault()
228 	{
229 		return gtk_text_get_activates_default(gtkText) != 0;
230 	}
231 
232 	/**
233 	 * Gets the attribute list that was set on the `GtkText`.
234 	 *
235 	 * See [method@Gtk.Text.set_attributes].
236 	 *
237 	 * Returns: the attribute list
238 	 */
239 	public PgAttributeList getAttributes()
240 	{
241 		auto __p = gtk_text_get_attributes(gtkText);
242 
243 		if(__p is null)
244 		{
245 			return null;
246 		}
247 
248 		return ObjectG.getDObject!(PgAttributeList)(cast(PangoAttrList*) __p);
249 	}
250 
251 	/**
252 	 * Get the `GtkEntryBuffer` object which holds the text for
253 	 * this widget.
254 	 *
255 	 * Returns: A `GtkEntryBuffer` object.
256 	 */
257 	public EntryBuffer getBuffer()
258 	{
259 		auto __p = gtk_text_get_buffer(gtkText);
260 
261 		if(__p is null)
262 		{
263 			return null;
264 		}
265 
266 		return ObjectG.getDObject!(EntryBuffer)(cast(GtkEntryBuffer*) __p);
267 	}
268 
269 	/**
270 	 * Returns whether Emoji completion is enabled for this
271 	 * `GtkText` widget.
272 	 *
273 	 * Returns: %TRUE if Emoji completion is enabled
274 	 */
275 	public bool getEnableEmojiCompletion()
276 	{
277 		return gtk_text_get_enable_emoji_completion(gtkText) != 0;
278 	}
279 
280 	/**
281 	 * Gets the menu model for extra items in the context menu.
282 	 *
283 	 * See [method@Gtk.Text.set_extra_menu].
284 	 *
285 	 * Returns: the menu model
286 	 */
287 	public MenuModel getExtraMenu()
288 	{
289 		auto __p = gtk_text_get_extra_menu(gtkText);
290 
291 		if(__p is null)
292 		{
293 			return null;
294 		}
295 
296 		return ObjectG.getDObject!(MenuModel)(cast(GMenuModel*) __p);
297 	}
298 
299 	/**
300 	 * Gets the input hints of the `GtkText`.
301 	 */
302 	public GtkInputHints getInputHints()
303 	{
304 		return gtk_text_get_input_hints(gtkText);
305 	}
306 
307 	/**
308 	 * Gets the input purpose of the `GtkText`.
309 	 */
310 	public GtkInputPurpose getInputPurpose()
311 	{
312 		return gtk_text_get_input_purpose(gtkText);
313 	}
314 
315 	/**
316 	 * Retrieves the character displayed when visibility is set to false.
317 	 *
318 	 * Note that GTK does not compute this value unless it needs it,
319 	 * so the value returned by this function is not very useful unless
320 	 * it has been explicitly set with [method@Gtk.Text.set_invisible_char].
321 	 *
322 	 * Returns: the current invisible char, or 0, if @text does not
323 	 *     show invisible text at all.
324 	 */
325 	public dchar getInvisibleChar()
326 	{
327 		return gtk_text_get_invisible_char(gtkText);
328 	}
329 
330 	/**
331 	 * Retrieves the maximum allowed length of the text in @self.
332 	 *
333 	 * See [method@Gtk.Text.set_max_length].
334 	 *
335 	 * This is equivalent to getting @self's `GtkEntryBuffer` and
336 	 * calling [method@Gtk.EntryBuffer.get_max_length] on it.
337 	 *
338 	 * Returns: the maximum allowed number of characters
339 	 *     in `GtkText`, or 0 if there is no maximum.
340 	 */
341 	public int getMaxLength()
342 	{
343 		return gtk_text_get_max_length(gtkText);
344 	}
345 
346 	/**
347 	 * Gets whether text is overwritten when typing in the `GtkText`.
348 	 *
349 	 * See [method@Gtk.Text.set_overwrite_mode].
350 	 *
351 	 * Returns: whether the text is overwritten when typing
352 	 */
353 	public bool getOverwriteMode()
354 	{
355 		return gtk_text_get_overwrite_mode(gtkText) != 0;
356 	}
357 
358 	/**
359 	 * Retrieves the text that will be displayed when
360 	 * @self is empty and unfocused
361 	 *
362 	 * If no placeholder text has been set, %NULL will be returned.
363 	 *
364 	 * Returns: the placeholder text
365 	 */
366 	public string getPlaceholderText()
367 	{
368 		return Str.toString(gtk_text_get_placeholder_text(gtkText));
369 	}
370 
371 	/**
372 	 * Returns whether the `GtkText` will grow and shrink
373 	 * with the content.
374 	 *
375 	 * Returns: %TRUE if @self will propagate the text width
376 	 */
377 	public bool getPropagateTextWidth()
378 	{
379 		return gtk_text_get_propagate_text_width(gtkText) != 0;
380 	}
381 
382 	/**
383 	 * Gets the tabstops that were set on the `GtkText`.
384 	 *
385 	 * See [method@Gtk.Text.set_tabs].
386 	 *
387 	 * Returns: the tabstops
388 	 */
389 	public PgTabArray getTabs()
390 	{
391 		auto __p = gtk_text_get_tabs(gtkText);
392 
393 		if(__p is null)
394 		{
395 			return null;
396 		}
397 
398 		return ObjectG.getDObject!(PgTabArray)(cast(PangoTabArray*) __p);
399 	}
400 
401 	/**
402 	 * Retrieves the current length of the text in @self.
403 	 *
404 	 * This is equivalent to getting @self's `GtkEntryBuffer`
405 	 * and calling [method@Gtk.EntryBuffer.get_length] on it.
406 	 *
407 	 * Returns: the current number of characters
408 	 *     in `GtkText`, or 0 if there are none.
409 	 */
410 	public ushort getTextLength()
411 	{
412 		return gtk_text_get_text_length(gtkText);
413 	}
414 
415 	/**
416 	 * Returns whether the `GtkText` will truncate multi-line text
417 	 * that is pasted into the widget
418 	 *
419 	 * Returns: %TRUE if @self will truncate multi-line text
420 	 */
421 	public bool getTruncateMultiline()
422 	{
423 		return gtk_text_get_truncate_multiline(gtkText) != 0;
424 	}
425 
426 	/**
427 	 * Retrieves whether the text in @self is visible.
428 	 *
429 	 * Returns: %TRUE if the text is currently visible
430 	 */
431 	public bool getVisibility()
432 	{
433 		return gtk_text_get_visibility(gtkText) != 0;
434 	}
435 
436 	/**
437 	 * Causes @self to have keyboard focus.
438 	 *
439 	 * It behaves like [method@Gtk.Widget.grab_focus],
440 	 * except that it doesn't select the contents of @self.
441 	 * You only want to call this on some special entries
442 	 * which the user usually doesn't want to replace all text in,
443 	 * such as search-as-you-type entries.
444 	 *
445 	 * Returns: %TRUE if focus is now inside @self
446 	 */
447 	public bool grabFocusWithoutSelecting()
448 	{
449 		return gtk_text_grab_focus_without_selecting(gtkText) != 0;
450 	}
451 
452 	/**
453 	 * If @activates is %TRUE, pressing Enter will activate
454 	 * the default widget for the window containing @self.
455 	 *
456 	 * This usually means that the dialog containing the `GtkText`
457 	 * will be closed, since the default widget is usually one of
458 	 * the dialog buttons.
459 	 *
460 	 * Params:
461 	 *     activates = %TRUE to activate window’s default widget on Enter keypress
462 	 */
463 	public void setActivatesDefault(bool activates)
464 	{
465 		gtk_text_set_activates_default(gtkText, activates);
466 	}
467 
468 	/**
469 	 * Sets attributes that are applied to the text.
470 	 *
471 	 * Params:
472 	 *     attrs = a `PangoAttrList`
473 	 */
474 	public void setAttributes(PgAttributeList attrs)
475 	{
476 		gtk_text_set_attributes(gtkText, (attrs is null) ? null : attrs.getPgAttributeListStruct());
477 	}
478 
479 	/**
480 	 * Set the `GtkEntryBuffer` object which holds the text for
481 	 * this widget.
482 	 *
483 	 * Params:
484 	 *     buffer = a `GtkEntryBuffer`
485 	 */
486 	public void setBuffer(EntryBuffer buffer)
487 	{
488 		gtk_text_set_buffer(gtkText, (buffer is null) ? null : buffer.getEntryBufferStruct());
489 	}
490 
491 	/**
492 	 * Sets whether Emoji completion is enabled.
493 	 *
494 	 * If it is, typing ':', followed by a recognized keyword,
495 	 * will pop up a window with suggested Emojis matching the
496 	 * keyword.
497 	 *
498 	 * Params:
499 	 *     enableEmojiCompletion = %TRUE to enable Emoji completion
500 	 */
501 	public void setEnableEmojiCompletion(bool enableEmojiCompletion)
502 	{
503 		gtk_text_set_enable_emoji_completion(gtkText, enableEmojiCompletion);
504 	}
505 
506 	/**
507 	 * Sets a menu model to add when constructing
508 	 * the context menu for @self.
509 	 *
510 	 * Params:
511 	 *     model = a `GMenuModel`
512 	 */
513 	public void setExtraMenu(MenuModel model)
514 	{
515 		gtk_text_set_extra_menu(gtkText, (model is null) ? null : model.getMenuModelStruct());
516 	}
517 
518 	/**
519 	 * Sets input hints that allow input methods
520 	 * to fine-tune their behaviour.
521 	 *
522 	 * Params:
523 	 *     hints = the hints
524 	 */
525 	public void setInputHints(GtkInputHints hints)
526 	{
527 		gtk_text_set_input_hints(gtkText, hints);
528 	}
529 
530 	/**
531 	 * Sets the input purpose of the `GtkText`.
532 	 *
533 	 * This can be used by on-screen keyboards and other
534 	 * input methods to adjust their behaviour.
535 	 *
536 	 * Params:
537 	 *     purpose = the purpose
538 	 */
539 	public void setInputPurpose(GtkInputPurpose purpose)
540 	{
541 		gtk_text_set_input_purpose(gtkText, purpose);
542 	}
543 
544 	/**
545 	 * Sets the character to use when in “password mode”.
546 	 *
547 	 * By default, GTK picks the best invisible char available in the
548 	 * current font. If you set the invisible char to 0, then the user
549 	 * will get no feedback at all; there will be no text on the screen
550 	 * as they type.
551 	 *
552 	 * Params:
553 	 *     ch = a Unicode character
554 	 */
555 	public void setInvisibleChar(dchar ch)
556 	{
557 		gtk_text_set_invisible_char(gtkText, ch);
558 	}
559 
560 	/**
561 	 * Sets the maximum allowed length of the contents of the widget.
562 	 *
563 	 * If the current contents are longer than the given length, then
564 	 * they will be truncated to fit.
565 	 *
566 	 * This is equivalent to getting @self's `GtkEntryBuffer` and
567 	 * calling [method@Gtk.EntryBuffer.set_max_length] on it.
568 	 *
569 	 * Params:
570 	 *     length = the maximum length of the `GtkText`, or 0 for no maximum.
571 	 *         (other than the maximum length of entries.) The value passed
572 	 *         in will be clamped to the range 0-65536.
573 	 */
574 	public void setMaxLength(int length)
575 	{
576 		gtk_text_set_max_length(gtkText, length);
577 	}
578 
579 	/**
580 	 * Sets whether the text is overwritten when typing
581 	 * in the `GtkText`.
582 	 *
583 	 * Params:
584 	 *     overwrite = new value
585 	 */
586 	public void setOverwriteMode(bool overwrite)
587 	{
588 		gtk_text_set_overwrite_mode(gtkText, overwrite);
589 	}
590 
591 	/**
592 	 * Sets text to be displayed in @self when it is empty.
593 	 *
594 	 * This can be used to give a visual hint of the expected
595 	 * contents of the `GtkText`.
596 	 *
597 	 * Params:
598 	 *     text = a string to be displayed when @self
599 	 *         is empty and unfocused
600 	 */
601 	public void setPlaceholderText(string text)
602 	{
603 		gtk_text_set_placeholder_text(gtkText, Str.toStringz(text));
604 	}
605 
606 	/**
607 	 * Sets whether the `GtkText` should grow and shrink with the content.
608 	 *
609 	 * Params:
610 	 *     propagateTextWidth = %TRUE to propagate the text width
611 	 */
612 	public void setPropagateTextWidth(bool propagateTextWidth)
613 	{
614 		gtk_text_set_propagate_text_width(gtkText, propagateTextWidth);
615 	}
616 
617 	/**
618 	 * Sets tabstops that are applied to the text.
619 	 *
620 	 * Params:
621 	 *     tabs = a `PangoTabArray`
622 	 */
623 	public void setTabs(PgTabArray tabs)
624 	{
625 		gtk_text_set_tabs(gtkText, (tabs is null) ? null : tabs.getPgTabArrayStruct());
626 	}
627 
628 	/**
629 	 * Sets whether the `GtkText` should truncate multi-line text
630 	 * that is pasted into the widget.
631 	 *
632 	 * Params:
633 	 *     truncateMultiline = %TRUE to truncate multi-line text
634 	 */
635 	public void setTruncateMultiline(bool truncateMultiline)
636 	{
637 		gtk_text_set_truncate_multiline(gtkText, truncateMultiline);
638 	}
639 
640 	/**
641 	 * Sets whether the contents of the `GtkText` are visible or not.
642 	 *
643 	 * When visibility is set to %FALSE, characters are displayed
644 	 * as the invisible char, and will also appear that way when
645 	 * the text in the widget is copied to the clipboard.
646 	 *
647 	 * By default, GTK picks the best invisible character available
648 	 * in the current font, but it can be changed with
649 	 * [method@Gtk.Text.set_invisible_char].
650 	 *
651 	 * Note that you probably want to set [property@Gtk.Text:input-purpose]
652 	 * to %GTK_INPUT_PURPOSE_PASSWORD or %GTK_INPUT_PURPOSE_PIN to
653 	 * inform input methods about the purpose of this self,
654 	 * in addition to setting visibility to %FALSE.
655 	 *
656 	 * Params:
657 	 *     visible = %TRUE if the contents of the `GtkText` are displayed
658 	 *         as plaintext
659 	 */
660 	public void setVisibility(bool visible)
661 	{
662 		gtk_text_set_visibility(gtkText, visible);
663 	}
664 
665 	/**
666 	 * Unsets the invisible char.
667 	 *
668 	 * After calling this, the default invisible
669 	 * char is used again.
670 	 */
671 	public void unsetInvisibleChar()
672 	{
673 		gtk_text_unset_invisible_char(gtkText);
674 	}
675 
676 	/**
677 	 * Emitted when the user hits the Enter key.
678 	 *
679 	 * The default bindings for this signal are all forms
680 	 * of the <kbd>Enter</kbd> key.
681 	 */
682 	gulong addOnActivate(void delegate(Text) dlg, ConnectFlags connectFlags=cast(ConnectFlags)0)
683 	{
684 		return Signals.connect(this, "activate", dlg, connectFlags ^ ConnectFlags.SWAPPED);
685 	}
686 
687 	/**
688 	 * Emitted when the user asks for it.
689 	 *
690 	 * This is a [keybinding signal](class.SignalAction.html).
691 	 *
692 	 * The default bindings for this signal are
693 	 * <kbd>Backspace</kbd> and <kbd>Shift</kbd>-<kbd>Backspace</kbd>.
694 	 */
695 	gulong addOnBackspace(void delegate(Text) dlg, ConnectFlags connectFlags=cast(ConnectFlags)0)
696 	{
697 		return Signals.connect(this, "backspace", dlg, connectFlags ^ ConnectFlags.SWAPPED);
698 	}
699 
700 	/**
701 	 * Emitted to copy the selection to the clipboard.
702 	 *
703 	 * This is a [keybinding signal](class.SignalAction.html).
704 	 *
705 	 * The default bindings for this signal are
706 	 * <kbd>Ctrl</kbd>-<kbd>c</kbd> and
707 	 * <kbd>Ctrl</kbd>-<kbd>Insert</kbd>.
708 	 */
709 	gulong addOnCopyClipboard(void delegate(Text) dlg, ConnectFlags connectFlags=cast(ConnectFlags)0)
710 	{
711 		return Signals.connect(this, "copy-clipboard", dlg, connectFlags ^ ConnectFlags.SWAPPED);
712 	}
713 
714 	/**
715 	 * Emitted to cut the selection to the clipboard.
716 	 *
717 	 * This is a [keybinding signal](class.SignalAction.html).
718 	 *
719 	 * The default bindings for this signal are
720 	 * <kbd>Ctrl</kbd>-<kbd>x</kbd> and
721 	 * <kbd>Shift</kbd>-<kbd>Delete</kbd>.
722 	 */
723 	gulong addOnCutClipboard(void delegate(Text) dlg, ConnectFlags connectFlags=cast(ConnectFlags)0)
724 	{
725 		return Signals.connect(this, "cut-clipboard", dlg, connectFlags ^ ConnectFlags.SWAPPED);
726 	}
727 
728 	/**
729 	 * Emitted when the user initiates a text deletion.
730 	 *
731 	 * This is a [keybinding signal](class.SignalAction.html).
732 	 *
733 	 * If the @type is %GTK_DELETE_CHARS, GTK deletes the selection
734 	 * if there is one, otherwise it deletes the requested number
735 	 * of characters.
736 	 *
737 	 * The default bindings for this signal are <kbd>Delete</kbd>
738 	 * for deleting a character and <kbd>Ctrl</kbd>-<kbd>Delete</kbd>
739 	 * for deleting a word.
740 	 *
741 	 * Params:
742 	 *     type = the granularity of the deletion, as a `GtkDeleteType`
743 	 *     count = the number of @type units to delete
744 	 */
745 	gulong addOnDeleteFromCursor(void delegate(GtkDeleteType, int, Text) dlg, ConnectFlags connectFlags=cast(ConnectFlags)0)
746 	{
747 		return Signals.connect(this, "delete-from-cursor", dlg, connectFlags ^ ConnectFlags.SWAPPED);
748 	}
749 
750 	/**
751 	 * Emitted when the user initiates the insertion of a
752 	 * fixed string at the cursor.
753 	 *
754 	 * This is a [keybinding signal](class.SignalAction.html).
755 	 *
756 	 * This signal has no default bindings.
757 	 *
758 	 * Params:
759 	 *     string_ = the string to insert
760 	 */
761 	gulong addOnInsertAtCursor(void delegate(string, Text) dlg, ConnectFlags connectFlags=cast(ConnectFlags)0)
762 	{
763 		return Signals.connect(this, "insert-at-cursor", dlg, connectFlags ^ ConnectFlags.SWAPPED);
764 	}
765 
766 	/**
767 	 * Emitted to present the Emoji chooser for the widget.
768 	 *
769 	 * This is a [keybinding signal](class.SignalAction.html).
770 	 *
771 	 * The default bindings for this signal are
772 	 * <kbd>Ctrl</kbd>-<kbd>.</kbd> and
773 	 * <kbd>Ctrl</kbd>-<kbd>;</kbd>
774 	 */
775 	gulong addOnInsertEmoji(void delegate(Text) dlg, ConnectFlags connectFlags=cast(ConnectFlags)0)
776 	{
777 		return Signals.connect(this, "insert-emoji", dlg, connectFlags ^ ConnectFlags.SWAPPED);
778 	}
779 
780 	/**
781 	 * Emitted when the user initiates a cursor movement.
782 	 *
783 	 * If the cursor is not visible in @self, this signal causes
784 	 * the viewport to be moved instead.
785 	 *
786 	 * This is a [keybinding signal](class.SignalAction.html).
787 	 *
788 	 * Applications should not connect to it, but may emit it with
789 	 * g_signal_emit_by_name() if they need to control the cursor
790 	 * programmatically.
791 	 *
792 	 * The default bindings for this signal come in two variants,
793 	 * the variant with the <kbd>Shift</kbd> modifier extends the
794 	 * selection, the variant without it does not.
795 	 * There are too many key combinations to list them all here.
796 	 *
797 	 * - <kbd>←</kbd>, <kbd>→</kbd>, <kbd>↑</kbd>, <kbd>↓</kbd>
798 	 * move by individual characters/lines
799 	 * - <kbd>Ctrl</kbd>-<kbd>→</kbd>, etc. move by words/paragraphs
800 	 * - <kbd>Home</kbd>, <kbd>End</kbd> move to the ends of the buffer
801 	 *
802 	 * Params:
803 	 *     step = the granularity of the move, as a `GtkMovementStep`
804 	 *     count = the number of @step units to move
805 	 *     extend = %TRUE if the move should extend the selection
806 	 */
807 	gulong addOnMoveCursor(void delegate(GtkMovementStep, int, bool, Text) dlg, ConnectFlags connectFlags=cast(ConnectFlags)0)
808 	{
809 		return Signals.connect(this, "move-cursor", dlg, connectFlags ^ ConnectFlags.SWAPPED);
810 	}
811 
812 	/**
813 	 * Emitted to paste the contents of the clipboard.
814 	 *
815 	 * This is a [keybinding signal](class.SignalAction.html).
816 	 *
817 	 * The default bindings for this signal are
818 	 * <kbd>Ctrl</kbd>-<kbd>v</kbd> and <kbd>Shift</kbd>-<kbd>Insert</kbd>.
819 	 */
820 	gulong addOnPasteClipboard(void delegate(Text) dlg, ConnectFlags connectFlags=cast(ConnectFlags)0)
821 	{
822 		return Signals.connect(this, "paste-clipboard", dlg, connectFlags ^ ConnectFlags.SWAPPED);
823 	}
824 
825 	/**
826 	 * Emitted when the preedit text changes.
827 	 *
828 	 * If an input method is used, the typed text will not immediately
829 	 * be committed to the buffer. So if you are interested in the text,
830 	 * connect to this signal.
831 	 *
832 	 * Params:
833 	 *     preedit = the current preedit string
834 	 */
835 	gulong addOnPreeditChanged(void delegate(string, Text) dlg, ConnectFlags connectFlags=cast(ConnectFlags)0)
836 	{
837 		return Signals.connect(this, "preedit-changed", dlg, connectFlags ^ ConnectFlags.SWAPPED);
838 	}
839 
840 	/**
841 	 * Emitted to toggle the overwrite mode of the `GtkText`.
842 	 *
843 	 * This is a [keybinding signal](class.SignalAction.html).
844 	 *
845 	 * The default bindings for this signal is <kbd>Insert</kbd>.
846 	 */
847 	gulong addOnToggleOverwrite(void delegate(Text) dlg, ConnectFlags connectFlags=cast(ConnectFlags)0)
848 	{
849 		return Signals.connect(this, "toggle-overwrite", dlg, connectFlags ^ ConnectFlags.SWAPPED);
850 	}
851 }